//
//  ZYCGrowthFileHeaderView.m
//  ZDSC
//
//  Created by ZDTX on 2021/9/19.
//

#import "ZYCGrowthFileHeaderView.h"
@interface ZYCGrowthFileHeaderView ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *selectButton;
@end

@implementation ZYCGrowthFileHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = HEX_RGB(@"FFFFFF");
        [self addSubview:self.titleLabel];
        [self addSubview:self.selectButton];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(30.0f);
            make.left.equalTo(self).offset(10.0f);
        }];
        
        [self.selectButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.titleLabel);
            make.left.equalTo(self.titleLabel.mas_right).offset(15.0f);
            make.size.mas_equalTo(CGSizeMake(75.0f, 75.0f));
        }];
        
    }
    return self;
}

- (UIButton *)selectButton {
    if (!_selectButton) {
        _selectButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_selectButton setImage:[UIImage imageNamed:@"x"] forState:UIControlStateNormal];
        [_selectButton addTarget:self action:@selector(clickSelectAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _selectButton;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel =[UILabel LabelWithString:@"今天" Font:kCustomFont(@"PingFangSC-Semibold", 28.0f) titleColor:HEX_RGB(@"#2B302D") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (void)clickSelectAction:(UIButton *)sender{
    if (self.selectImageBlock) {
        self.selectImageBlock(self.model);
    }
}
@end
